<%@ taglib prefix="spring-tags" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="spring-form" uri="http://www.springframework.org/tags/form"%>
<%@ page
    import="org.jiscinvolve.astrodabis.barberry.control.Paths"
    import="org.jiscinvolve.astrodabis.barberry.control.ObjectData"
    import="org.jiscinvolve.astrodabis.barberry.control.RequestData"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Account"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Tag"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Job"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Job.AnnotType"
    import="org.jiscinvolve.astrodabis.barberry.common.data.RowTag"
    import="org.jiscinvolve.astrodabis.barberry.common.data.JoinTag"
    session="true"
%><%
ObjectData<Job> data = (ObjectData<Job>) request.getAttribute(
    RequestData.MODEL_ATTRIB
    ) ;
Account actor = data.actor();
Job job  = data.object();
%>
<html>
    <head>
	    <title>AstroDAbis job <%= job.ident() %></title>
        <link href='<%= data.file("css/page.css") %>' rel='stylesheet' type='text/css'/>
    </head>
    <body>
        <%@ include file="/jsp/header.jsp" %>
        <div class='body'>
            <div class='left'>
                <%@ include file="/jsp/menu.jsp" %>
            </div>
            <div class='right'>
                <a href='<%= data.link(job) %>'>
                    <img src='<%= data.qrcode(data.link(job)) %>'/>
                </a>
            </div>
            <div class='content'>
        	    <h2>Data import <%= job.name() %></h2>
                <fieldset>
                    <legend>Details</legend>
                    <div>
                        <ul>
                            <li>
                                Owner : <a href='<%= data.link(job.owner()) %>'><%= job.owner().name() %></a>
                            </li>
                            <li>
                                Name : <%= job.name() %>
                            </li>
                            <li>
                                Status : <%= job.status() %>
                            </li>
                            <li>
                                Type : <%= job.annotType() %>
                            </li>
                            <li>
                                Started : <%= job.started() %>
                            </li>
                            <li>
                                Finished : <%= job.finished() %>
                            </li>
                            <li>
                                Row count : <%= job.count() %>
                            </li>
                            <%
                            if (job.status() == Job.Status.COMPLETED)
                                {
                                if ((job.started() != null) && (job.finished() != null))
                                    {
                                    long time = job.finished().getTime() - job.started().getTime() ;
                                    if (time > 0)
                                        {
                                        %>
                                        <li>
                                            Rows/sec : <%= (job.count() * 1000) / time %>
                                        </li>
                                        <%
                                        }
                                    }
                                }
                            %>
                        </ul>
                    </div>
                    <div>
                        Delete this job ?
                        <form method='post' action='<%= data.link(job, "delete") %>'>
    			            <button type='submit' name='confirm' value='true'>delete</button>
    			            <button type='submit' name='confirm' value='false'>cancel</button>
                        </form>
                    </div>
                </fieldset>
            </div>
        </div>
        <%@ include file="/jsp/footer.jsp" %>
    </body>
</html>

